.class public Ljavax/microedition/lcdui/Gauge;
.super Ljavax/microedition/lcdui/Item;
.source "Gauge.java"


# static fields
.field public static final CONTINUOUS_IDLE:I = 0x0

.field public static final CONTINUOUS_RUNNING:I = 0x2

.field static HEIGHT:I = 0x0

.field private static final IDEFINITE_FRAMES:I = 0x4

.field public static final INCREMENTAL_IDLE:I = 0x1

.field public static final INCREMENTAL_UPDATING:I = 0x3

.field public static final INDEFINITE:I = -0x1

.field static PAINT_TIMEOUT:I


# instance fields
.field private indefiniteFrame:I

.field interactive:Z

.field maxValue:I

.field prefHeight:I

.field prefWidth:I

.field value:I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 28
    const/16 v0, 0xf

    sput v0, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    .line 44
    const/16 v0, 0x1f4

    sput v0, Ljavax/microedition/lcdui/Gauge;->PAINT_TIMEOUT:I

    return-void
.end method

.method public constructor <init>(Ljava/lang/String;ZII)V
    .locals 0
    .parameter "label"
    .parameter "interactive"
    .parameter "maxValue"
    .parameter "initialValue"

    .prologue
    .line 51
    invoke-direct {p0, p1}, Ljavax/microedition/lcdui/Item;-><init>(Ljava/lang/String;)V

    .line 53
    iput-boolean p2, p0, Ljavax/microedition/lcdui/Gauge;->interactive:Z

    .line 55
    invoke-virtual {p0, p3}, Ljavax/microedition/lcdui/Gauge;->setMaxValue(I)V

    .line 56
    invoke-virtual {p0, p4}, Ljavax/microedition/lcdui/Gauge;->setValue(I)V

    .line 57
    return-void
.end method


# virtual methods
.method public addCommand(Ljavax/microedition/lcdui/Command;)V
    .locals 1
    .parameter "cmd"

    .prologue
    .line 265
    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    if-eqz v0, :cond_0

    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    instance-of v0, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v0, :cond_0

    .line 269
    :goto_0
    return-void

    .line 268
    :cond_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->addCommand(Ljavax/microedition/lcdui/Command;)V

    goto :goto_0
.end method

.method getHeight()I
    .locals 2

    .prologue
    .line 159
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v0

    sget v1, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    add-int/2addr v0, v1

    return v0
.end method

.method public getMaxValue()I
    .locals 1

    .prologue
    .line 127
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    return v0
.end method

.method public getValue()I
    .locals 1

    .prologue
    .line 95
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    return v0
.end method

.method hasIndefiniteRange()Z
    .locals 2

    .prologue
    .line 139
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->isInteractive()Z

    move-result v0

    if-nez v0, :cond_0

    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getMaxValue()I

    move-result v0

    const/4 v1, -0x1

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method isFocusable()Z
    .locals 1

    .prologue
    .line 165
    iget-boolean v0, p0, Ljavax/microedition/lcdui/Gauge;->interactive:Z

    return v0
.end method

.method public isInteractive()Z
    .locals 1

    .prologue
    .line 133
    iget-boolean v0, p0, Ljavax/microedition/lcdui/Gauge;->interactive:Z

    return v0
.end method

.method keyPressed(I)V
    .locals 2
    .parameter "keyCode"

    .prologue
    .line 171
    invoke-static {p1}, Ljavax/microedition/lcdui/Display;->getGameAction(I)I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_1

    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    if-lez v0, :cond_1

    .line 172
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    const/4 v1, 0x1

    sub-int/2addr v0, v1

    iput v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    .line 173
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    .line 178
    :cond_0
    :goto_0
    return-void

    .line 174
    :cond_1
    invoke-static {p1}, Ljavax/microedition/lcdui/Display;->getGameAction(I)I

    move-result v0

    const/4 v1, 0x5

    if-ne v0, v1, :cond_0

    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    iget v1, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    if-ge v0, v1, :cond_0

    .line 175
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    .line 176
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    goto :goto_0
.end method

.method paint(Ljavax/microedition/lcdui/Graphics;)I
    .locals 10
    .parameter "g"

    .prologue
    const/4 v9, 0x5

    const/4 v8, 0x2

    const/4 v7, 0x0

    const/16 v6, 0x8

    const/4 v5, 0x4

    .line 183
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->paintContent(Ljavax/microedition/lcdui/Graphics;)V

    .line 185
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v3

    invoke-virtual {p1, v7, v3}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 187
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->hasFocus()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 188
    iget-object v3, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v3

    sub-int/2addr v3, v9

    sget v4, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    sub-int/2addr v4, v9

    invoke-virtual {p1, v8, v8, v3, v4}, Ljavax/microedition/lcdui/Graphics;->drawRect(IIII)V

    .line 190
    :cond_0
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->hasIndefiniteRange()Z

    move-result v3

    if-eqz v3, :cond_5

    .line 191
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getValue()I

    move-result v3

    if-eqz v3, :cond_1

    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getValue()I

    move-result v3

    const/4 v4, 0x1

    if-ne v3, v4, :cond_3

    .line 193
    :cond_1
    iget-object v3, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v3

    const/16 v4, 0x9

    sub-int v1, v3, v4

    .line 194
    .local v1, width:I
    sget v3, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    const/16 v4, 0x9

    sub-int/2addr v3, v4

    invoke-virtual {p1, v5, v5, v1, v3}, Ljavax/microedition/lcdui/Graphics;->drawRect(IIII)V

    .line 214
    :cond_2
    :goto_0
    invoke-super {p0}, Ljavax/microedition/lcdui/Item;->getHeight()I

    move-result v3

    neg-int v3, v3

    invoke-virtual {p1, v7, v3}, Ljavax/microedition/lcdui/Graphics;->translate(II)V

    .line 215
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getHeight()I

    move-result v3

    return v3

    .line 196
    .end local v1           #width:I
    :cond_3
    iget-object v3, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v3

    sub-int/2addr v3, v6

    shl-int/lit8 v3, v3, 0x1

    div-int/lit8 v1, v3, 0x4

    .line 197
    .restart local v1       #width:I
    ushr-int/lit8 v3, v1, 0x1

    iget v4, p0, Ljavax/microedition/lcdui/Gauge;->indefiniteFrame:I

    mul-int v0, v3, v4

    .line 198
    .local v0, offset:I
    const/4 v2, 0x0

    .line 199
    .local v2, width2:I
    add-int v3, v0, v1

    iget-object v4, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v4}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v4

    sub-int/2addr v4, v6

    if-le v3, v4, :cond_4

    .line 200
    add-int v3, v0, v1

    iget-object v4, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v4}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v4

    sub-int/2addr v4, v6

    sub-int v2, v3, v4

    .line 201
    sub-int/2addr v1, v2

    .line 204
    :cond_4
    add-int/lit8 v3, v0, 0x4

    sget v4, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    sub-int/2addr v4, v6

    invoke-virtual {p1, v3, v5, v1, v4}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    .line 205
    if-eqz v2, :cond_2

    .line 206
    sget v3, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    sub-int/2addr v3, v6

    invoke-virtual {p1, v5, v5, v2, v3}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    goto :goto_0

    .line 210
    .end local v1           #width:I
    .end local v0           #offset:I
    .end local v2           #width2:I
    :cond_5
    iget-object v3, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    invoke-virtual {v3}, Ljavax/microedition/lcdui/Screen;->getWidth()I

    move-result v3

    sub-int/2addr v3, v6

    iget v4, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    mul-int/2addr v3, v4

    iget v4, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    div-int v1, v3, v4

    .line 211
    .restart local v1       #width:I
    sget v3, Ljavax/microedition/lcdui/Gauge;->HEIGHT:I

    sub-int/2addr v3, v6

    invoke-virtual {p1, v5, v5, v1, v3}, Ljavax/microedition/lcdui/Graphics;->fillRect(IIII)V

    goto :goto_0
.end method

.method public setDefaultCommand(Ljavax/microedition/lcdui/Command;)V
    .locals 1
    .parameter "cmd"

    .prologue
    .line 272
    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    if-eqz v0, :cond_0

    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    instance-of v0, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v0, :cond_0

    .line 276
    :goto_0
    return-void

    .line 275
    :cond_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->setDefaultCommand(Ljavax/microedition/lcdui/Command;)V

    goto :goto_0
.end method

.method public setItemCommandListener(Ljavax/microedition/lcdui/ItemCommandListener;)V
    .locals 1
    .parameter "l"

    .prologue
    .line 279
    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    if-eqz v0, :cond_0

    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    instance-of v0, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v0, :cond_0

    .line 283
    :goto_0
    return-void

    .line 282
    :cond_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->setItemCommandListener(Ljavax/microedition/lcdui/ItemCommandListener;)V

    goto :goto_0
.end method

.method public setLabel(Ljava/lang/String;)V
    .locals 1
    .parameter "label"

    .prologue
    .line 258
    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    if-eqz v0, :cond_0

    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    instance-of v0, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v0, :cond_0

    .line 262
    :goto_0
    return-void

    .line 261
    :cond_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->setLabel(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public setLayout(I)V
    .locals 1
    .parameter "layout"

    .prologue
    .line 251
    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    if-eqz v0, :cond_0

    iget-object v0, p0, Ljavax/microedition/lcdui/Gauge;->owner:Ljavax/microedition/lcdui/Screen;

    instance-of v0, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v0, :cond_0

    .line 255
    :goto_0
    return-void

    .line 254
    :cond_0
    invoke-super {p0, p1}, Ljavax/microedition/lcdui/Item;->setLayout(I)V

    goto :goto_0
.end method

.method public setMaxValue(I)V
    .locals 2
    .parameter "maxValue"

    .prologue
    const/4 v1, -0x1

    .line 101
    if-lez p1, :cond_1

    .line 102
    iput p1, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    .line 103
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getValue()I

    move-result v0

    invoke-virtual {p0, v0}, Ljavax/microedition/lcdui/Gauge;->setValue(I)V

    .line 122
    :cond_0
    :goto_0
    return-void

    .line 105
    :cond_1
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->isInteractive()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 106
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 107
    :cond_2
    if-eq p1, v1, :cond_3

    .line 108
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 113
    :cond_3
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    if-eq v0, v1, :cond_0

    .line 116
    iput v1, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    .line 117
    const/4 v0, 0x1

    iput v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    .line 118
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    goto :goto_0
.end method

.method public setPreferredSize(II)V
    .locals 2
    .parameter "w"
    .parameter "h"

    .prologue
    .line 242
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getOwner()Ljavax/microedition/lcdui/Screen;

    move-result-object v0

    .line 244
    .local v0, owner:Ljavax/microedition/lcdui/Screen;
    if-eqz v0, :cond_0

    instance-of v1, v0, Ljavax/microedition/lcdui/Alert;

    if-eqz v1, :cond_0

    .line 248
    :goto_0
    return-void

    .line 247
    :cond_0
    invoke-super {p0, p1, p2}, Ljavax/microedition/lcdui/Item;->setPreferredSize(II)V

    goto :goto_0
.end method

.method public setValue(I)V
    .locals 2
    .parameter "value"

    .prologue
    const/4 v1, 0x3

    .line 62
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->hasIndefiniteRange()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 63
    if-eqz p1, :cond_0

    const/4 v0, 0x2

    if-eq p1, v0, :cond_0

    const/4 v0, 0x1

    if-eq p1, v0, :cond_0

    if-eq p1, v1, :cond_0

    .line 67
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    .line 71
    :cond_0
    if-ne p1, v1, :cond_1

    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    if-ne v0, v1, :cond_1

    .line 73
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->updateIndefiniteFrame()V

    .line 90
    :goto_0
    return-void

    .line 75
    :cond_1
    iput p1, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    .line 76
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    goto :goto_0

    .line 80
    :cond_2
    if-gez p1, :cond_3

    .line 81
    const/4 p1, 0x0

    .line 83
    :cond_3
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    if-le p1, v0, :cond_4

    .line 84
    iget p1, p0, Ljavax/microedition/lcdui/Gauge;->maxValue:I

    .line 87
    :cond_4
    iput p1, p0, Ljavax/microedition/lcdui/Gauge;->value:I

    .line 88
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    goto :goto_0
.end method

.method traverse(IIIZ)I
    .locals 2
    .parameter "gameKeyCode"
    .parameter "top"
    .parameter "bottom"
    .parameter "action"

    .prologue
    const v1, 0x7fffffff

    .line 221
    const/4 v0, 0x1

    if-ne p1, v0, :cond_1

    .line 222
    if-lez p2, :cond_0

    .line 223
    neg-int v0, p2

    .line 236
    :goto_0
    return v0

    :cond_0
    move v0, v1

    .line 225
    goto :goto_0

    .line 228
    :cond_1
    const/4 v0, 0x6

    if-ne p1, v0, :cond_3

    .line 229
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getHeight()I

    move-result v0

    if-le v0, p3, :cond_2

    .line 230
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getHeight()I

    move-result v0

    sub-int/2addr v0, p3

    goto :goto_0

    :cond_2
    move v0, v1

    .line 232
    goto :goto_0

    .line 236
    :cond_3
    const/4 v0, 0x0

    goto :goto_0
.end method

.method updateIndefiniteFrame()V
    .locals 2

    .prologue
    .line 145
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->hasIndefiniteRange()Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getValue()I

    move-result v0

    const/4 v1, 0x2

    if-eq v0, v1, :cond_0

    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->getValue()I

    move-result v0

    const/4 v1, 0x3

    if-ne v0, v1, :cond_1

    .line 148
    :cond_0
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->indefiniteFrame:I

    add-int/lit8 v0, v0, 0x1

    const/4 v1, 0x4

    if-ge v0, v1, :cond_2

    .line 149
    iget v0, p0, Ljavax/microedition/lcdui/Gauge;->indefiniteFrame:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Ljavax/microedition/lcdui/Gauge;->indefiniteFrame:I

    .line 152
    :goto_0
    invoke-virtual {p0}, Ljavax/microedition/lcdui/Gauge;->repaint()V

    .line 154
    :cond_1
    return-void

    .line 151
    :cond_2
    const/4 v0, 0x0

    iput v0, p0, Ljavax/microedition/lcdui/Gauge;->indefiniteFrame:I

    goto :goto_0
.end method
